<?php
/**
 * Created by PhpStorm.
 * User: User
 * Date: 2017/11/20
 * Time: 11:18
 */
//自动加载文件，项目必须！
include __DIR__ . './../vendor/autoload.php';

use Kinfy\Http\Route;
use Kinfy\Config;
use Kinfy\View;

Config::init(__DIR__ . './../App/config/');

if (Config::get('app.status') == 'SHUTDOWN') {
    View::show('shutdown');
    die;
}

//
spl_autoload_register(function ($name) {
    if (
        strpos($name, '\\') === false
        &&
        Config::get('app.providers.' . $name)
    ) {
    eval("
        class {$name} extends \Kinfy\Facades\Facade {
                protected static \$provider = '{$name}';
         }
         ");
    }
});

//插件加载
foreach(Config::get('app.plugins') as $plugin){
    include __DIR__.'./../App/plugins/'.$plugin.'.php';
}


//如果有需要，可以手动设置输出为UTF-8编码
//header("Content-type: text/html; charset=utf-8");

include __DIR__ . './../App/routes.php';

//路由转发
Route::dispatch();





